from fastapi import FastAPI
import uvicorn
from src.app.api.api import  app_router
from src.pc.api.api import pc_router
from src.public.api.api import pu_router
from fastapi.middleware.cors import CORSMiddleware
# import tracemalloc
# tracemalloc.start()
app = FastAPI()

# 跨域处理
app.add_middleware(
    CORSMiddleware,
    allow_origins=["*"],
    allow_credentials=True,
    allow_methods=["*"],
    allow_headers=["*"]
)
app.include_router(app_router)
app.include_router(pc_router)
app.include_router(pu_router)

if __name__ == "__main__":
    uvicorn.run(
        app="main:app",
        reload=True,
        host="127.0.0.1",
        port=9527
    )
